/**
 * Created with IntelliJ IDEA.
 * Description: 子2023
 * User: DELL
 * Date: 2024-05-23
 * Time: 9:30
 */
public class Main1 {
    public static void main(String[] args) {
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 1; i <= 2023; i++) {
            stringBuilder.append(i);
        }
        long[] pre2 = new long[stringBuilder.length() + 1];
        long[] after3 = new long[stringBuilder.length() + 1];
        for (int i = 0; i < stringBuilder.length(); i++) {
            if (stringBuilder.charAt(i) == '2') {
                pre2[i + 1] = pre2[i] + 1;
            } else {
                pre2[i + 1] = pre2[i];
            }
        }
        for (int i = stringBuilder.length() - 1; i > 0; i--) {
            if (stringBuilder.charAt(i) == '3') {
                after3[i - 1] = after3[i] + 1;
            } else {
                after3[i - 1] = after3[i];

            }
        }
        long ans = 0;
        // 暴力遍历 “02” 字符串组合
        for (int i = 0; i < stringBuilder.length() - 1; i++) {
            if (stringBuilder.charAt(i) == '0') {
                for (int j = i + 1; j < stringBuilder.length(); j++) {
                    if (stringBuilder.charAt(j) == '2') {
                        ans += pre2[i] * after3[j];
                    }
                }
            }
        }
        System.out.println(ans);
    }
}
